<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
<%@ page import="fulbitofacil.negocio.*"%>
<%@ page import="fulbitofacil.modelo.*"%>
<%@ page import="java.util.*"%>
<%@ page import="javax.servlet.http.HttpSession"%>
<%@ page import="javax.servlet.http.HttpServletRequest"%>



<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%
HttpSession sesion = request.getSession();
Persona p = (Persona)sesion.getAttribute("Persona");
%>
<html>
<head>
<link href="estilo.css" rel="stylesheet"/>
<script src="js/script0.js"></script>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<script type="text/javascript" src="/js/script.js"></script>
<script type="text/javascript" src="js/Validaciones.js"></script>
<script>
	function goTo() {
		document.frm.submit();
	}
	
	function ventanaSecundaria(theURL, params) {
		window.open(theURL, '', params);
	}
</script>
<title>Insert title here</title>
</head>
<body>
	
	<%@include file="header.jsp"%>
	<h2>Mis locales</h2>
	<hr>
	<form>
	<% 
		int idPersona = p.getId_persona(); // prueba
		LocalNegocio localNeg = new LocalNegocio();
		ArrayList<Local> locales = new ArrayList<Local>();
		locales = (ArrayList<Local>)localNeg.ListarLocal(idPersona);
		ArrayList<ArrayList<CanchaFul>> canchasXlocal = new ArrayList<ArrayList<CanchaFul>>(); 
		CanchaFulNegocio canchaNegocio = new CanchaFulNegocio();
		
	%>
	<% for(int x=0; x<locales.size(); x++){%>
	<h3>Local: <%=locales.get(x).getNombre()%> </h3>
	<div>
		<% 
			ArrayList<CanchaFul> canchitas = (ArrayList<CanchaFul>)canchaNegocio.listarCanchaPorLocal(locales.get(x).getIdLocal());
			canchasXlocal.add(canchitas);
		%>
	
		<table>

				<% for(int i=0; i<canchitas.size(); i++) {%>
					<tr>
					<%for(int j=0; j<2; j++) {%>
						<% if(j==0){%>
							<td>Cancha <%=canchitas.get(i).getNombre()%></td>
						<%}else{%>

							<td>
								<input type=button value="Agregar Servicios Adicionales"  
								onClick='javascript:ventanaSecundaria("detalleServiciosAd.jsp?idCancha=<%=canchitas.get(i).getIdCanchaFul()%>&nombre=<%=canchitas.get(i).getNombre()%>",
								"width=600,height=500, left=400,scrollbars=no")' name = "<%="b"+i%>">
							</td>
						<%}%>
					<%}%>
					</tr>
				<%} %>
			
		</table>
		</div>
		<%}%>
	</form>
	
	<%@include file="footer.jsp"%>
	


</body>
</html>